package com.training.entity;

import lombok.Data;
import java.math.BigDecimal;      // Import BigDecimal for precise price representation
import java.time.LocalDateTime;   // Import LocalDateTime for modern date-time handling

@Data
public class PurchaseRecord {

    private Long id;                // Primary key ID
    private Long studentId;         // Student ID
    private Long courseId;          // Course ID

    // --- CORE FIX: Changed the field type from Long to BigDecimal ---
    // This makes it compatible with the Course price and ensures accurate currency calculations.
    private BigDecimal purchasePrice;   // Price at the time of purchase

    // Using LocalDateTime is the modern standard, replacing Timestamp
    private LocalDateTime purchaseTime; // Purchase time

    // It's good practice to initialize the 'deleted' flag
    private Integer deleted = 0;      // Logical deletion flag (0: not deleted, 1: deleted)


    // --- Additional non-database fields for display purposes ---
    // These can be populated by JOIN queries to show more info on a "My Purchases" page.
    private String courseName;
    private String coursePic;
}